package org.ycsoft.MetroidReader;


/**
 * Wrapper class for all common constants and methode
 * @author allad
 *
 */
public class Commons {
	
	
	public static final int INFINITY = Integer.MAX_VALUE; //Positive Infinity constant
	public static final int DEFAULT_EDGE_LENGTH = 5*60; //Default travel time for an edge in seconds
	public static final int DEFAULT_CONNECTION_LENGTH = 5*60; //Default time to connect 2 lines in seconds
	public static final char LINE_SEPARATOR = '\n';
	public static final String DEFAULT_ENCODING = "utf-8";
	public static final int ID_DIGITS_NB = 4; //number of digits to format ids to
	public static final int POSITION_DIGITS_NB = 7; //number of digits to format file positions to
	public static final int LENGTH_DIGITS_NB = 5; //number of digits to travel lengths to
	public static final String METROID_EXTENSION = "mtd";
	public static final char PREFIX = '.';
	public static final char SEPARATOR = ':';
	public static final String UNIDIRECTIONAL = PREFIX+"unidirectional";
	
	
	public static final int STOP_MASK = 0x7FE00000;
	public static final int PREV_MASK = 0x1FF800;
	public static final int LINE_MASK = 0x7FF;
	/**
	 * Format a number to a string reprensatation
	 * @param n Number
	 * @param nbDigits Number of digits to write (leading zeros are added)
	 * @return
	 */
	public static String formatNumber(long n,int nbDigits){
		String tmp = String.valueOf(nbDigits);
		return String.format("%1$0"+tmp+"d", n);
	}



	
}
